ROOTCFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs)
ROOTGLIBS = $(shell root-config --glibs)

CXX = g++

name := g4test
G4TARGET := $(name)
TARGETDIR = $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(G4TARGET)
#TARGETDIR = ./
EVENTSO = $(TARGETDIR)/libTEvent.so

CXXFLAGS = -Wall -O2 $(ROOTCFLAGS) -g
CXXLIBS = $(ROOTLIBS)
CXXLIBS += $(EVENTSO)

SRC = test.cc
TARGET = r
OBJ = $(SRC:.cc=.o)


.PHONY: all clean distclean again

test: common.h
	$(CXX) -c $(CXXFLAGS) $(SRC)
	$(CXX) -o $(TARGET) $(OBJ) $(CXXLIBS)
	rm -f *.o

vectortest:
	$(CXX) -c $(CXXFLAGS) vectortest.cc
	$(CXX) -o $(TARGET) vectortest.o $(CXXLIBS)

clean:    
	rm -f libTEvent.so
	rm -f *Dict.cxx *Dict.h
	rm -f *.o $(TARGET) *.so

again:    
	make clean
	make

